<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>教师系统</title>
    <script src="../res/jiangtao/lib/mdl/material.min.js"></script>
    <script src="../res/js/jquery-3.0.0.min.js"></script>
    <script src="../res/jiangtao/lib/vue.min.js"></script>
    <script src="../res/jiangtao/lib/d3.v3.min.js"></script>
    <script src="../res/jiangtao/lib/c3.min.js"></script>
    <link href="../res/jiangtao/lib/c3.min.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="../res/jiangtao/lib/bootstrap/bootstrap.css">
    <script src="../res/jiangtao/lib/bootstrap/bootstrap.js"></script>
    <link rel="stylesheet" href="../res/jiangtao/lib/dist/summernote.css">
    <script src="../res/js/jquery.cookie.js"></script>
    <script src="../res/jiangtao/lib/dist/summernote.min.js"></script>
    <link rel="stylesheet" href="../res/jiangtao/lib/mdl/color_material.min.css">
    <link rel="stylesheet" href="../res/jiangtao/lib/mdl/icon.css">
</head>
<body>
<div id="toast" class="mdl-js-snackbar mdl-snackbar">
    <div class="mdl-snackbar__text">???</div>
    <button class="mdl-snackbar__action" type="button"></button>
</div>
<!-- Simple header with fixed tabs. -->
<div class="mdl-layout mdl-js-layout mdl-layout--fixed-header mdl-layout--fixed-tabs">
    <header class="mdl-layout__header">
        <div class="mdl-layout__header-row">
            <!-- Title -->
            <span class="mdl-layout-title">教师管理系统</span>
        </div>
        <!-- Tabs -->
        <div class="mdl-layout__tab-bar mdl-js-ripple-effect">
            <a href="#fixed-tab-1" class="mdl-layout__tab">课程发布</a>
            <a href="#fixed-tab-2" class="mdl-layout__tab">考试发布</a>
            <a href="#fixed-tab-3" class="mdl-layout__tab is-active">成绩录入</a>
            <a id="ly_4" href="#fixed-tab-4" class="mdl-layout__tab">成绩复查</a>
            <a href="static_demo.html" class="mdl-layout__tab">成绩统计评议</a>
        </div>
    </header>
    <div class="mdl-layout__drawer">
        <span class="mdl-layout-title">教师管理系统</span>
        <nav class="mdl-navigation">
        <a class="mdl-navigation__link" href="#" id="info">个人信息</a>
        <a class="mdl-navigation__link" href="#" id="mod">修改信息</a>
        <a class="mdl-navigation__link" href="#" id="logout">退出登陆</a>
        </nav>
    </div>
    <main class="mdl-layout__content">
        <section class="mdl-layout__tab-panel is-active" id="fixed-tab-1">
        <div class="page-content">
            <!-- Your content goes here -->
            <div class="mdl-layout mdl-js-layout mdl-layout--fixed-header
            mdl-layout--fixed-tabs">
                <header class="mdl-layout__header">
                    <!-- Tabs -->
                    <div class="mdl-layout__tab-bar mdl-js-ripple-effect">
                        <a href="#allclass" class="mdl-layout__tab is-active">所有可发布课程</a>
                        <a href="#allcs" class="mdl-layout__tab">已发布课程</a>
                    </div>
                </header>
                <main class="mdl-layout__content">
        <section class="mdl-layout__tab-panel is-active" id="allclass">
            <div class="page-content"><iframe src="allCourse.html" frameborder="0" width="300" height="1000" scrolling="No" leftmargin="0"  topmargin="0">

            </iframe></div>
        </section>
        <section class="mdl-layout__tab-panel" id="allcs">
            <div class="page-content"><iframe src="allCourseS.html" frameborder="0" width="300" scrolling="No" height="1000" leftmargin="0"  topmargin="0">

            </iframe></div>
        </section>

    </main>
</div>
<!--content ends-->
</div>
</section>
        <section class="mdl-layout__tab-panel" id="fixed-tab-2">
    <div class="page-content">
        <div class="mdl-layout mdl-js-layout mdl-layout--fixed-header
            mdl-layout--fixed-tabs">
            <header class="mdl-layout__header">
                <!-- Tabs -->
                <div class="mdl-layout__tab-bar mdl-js-ripple-effect">
                    <a href="#allcstoexam" class="mdl-layout__tab is-active">可发布考试课程</a>
                    <a href="#allexam" class="mdl-layout__tab">所有考试信息</a>
                </div>
            </header>
            <main class="mdl-layout__content">
                <section class="mdl-layout__tab-panel is-active" id="allcstoexam">
                    <div class="page-content"><iframe src="allCstoexam.html" frameborder="0" width="300" scrolling="No" height="1000" leftmargin="0"  topmargin="0">
                    </iframe>
                    </div>
                </section>
                <section class="mdl-layout__tab-panel" id="allexam">
                    <div class="page-content"><iframe src="allExam.html" frameborder="0" width="300" scrolling="No" height="1000" leftmargin="0"  topmargin="0">

                    </iframe></div>
                </section>

            </main>
        </div>
               </iframe>
            </div>
        </section>
        <section class="mdl-layout__tab-panel" id="fixed-tab-3">
            <div class="page-content" id="enterScore">
                <!-- Your content goes here -->
                    ##成绩录入
                <!--content ends-->
            </div>
        </section>
        <section class="mdl-layout__tab-panel" id="fixed-tab-4">
            <div class="page-content">
                <!-- Your content goes here -->
                <div class="mdl-layout mdl-js-layout mdl-layout--fixed-header">
                    <header class="mdl-layout__header">
                        <!-- Tabs -->
                        <div class="mdl-layout__tab-bar mdl-js-ripple-effect">
                            <a id="tab-link-1" href="#scroll-tab-1" class="mdl-layout__tab is-active">
                                新的复查
                                <span id="np_tag" class="mdl-badge" data-badge="0" style="display: none"></span>
                            </a>
                            <a href="#scroll-tab-2" class="mdl-layout__tab tag-link">
                                更新的复查
                                <span id="np_tag_updated" class="mdl-badge" data-badge="5" style="display: none"></span>
                            </a>
                            <!--<a href="#scroll-tab-3" class="mdl-layout__tab">已标记的复查</a>-->
                            <a id="link-rsp" href="#scroll-tab-4" class="mdl-layout__tab">已回执的复查</a>
                            <a id="link-closed" href="#scroll-tab-5" class="mdl-layout__tab">已关闭的复查</a>
                            <a id="link-all" href="#scroll-tab-6" class="mdl-layout__tab">全部复查信息</a>
                            <a id="link-draw" href="#scroll-tab-7" class="mdl-layout__tab">草稿箱</a>
                        </div>
                    </header>

                    <main class="mdl-layout__content">
                        <section class="mdl-layout__tab-panel is-active" id="scroll-tab-1">
                            <div class="page-content">
                                <!-- Your content goes here -->
                                <div style="width: 75%;margin: 0 auto;" id="p2" class="mdl-progress mdl-js-progress mdl-progress__indeterminate"></div>
                                <div id="zone" style="width: 75%; margin: 0 auto;text-align: center;display: none">
                                    <table  class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
                                        <thead>
                                        <tr>
                                            <th class="mdl-data-table__cell--non-numeric"></th>
                                            <th>所在院系</th>
                                            <th>课程名称</th>
                                            <th>学生姓名</th>
                                            <th>任课教师</th>
                                            <th>更新日期</th>
                                        </tr>
                                        </thead>
                                        <tbody id="ap_table">
                                        </tbody>
                                    </table>
                                </div>

                                <div></div>
                                <!--新的复查-->
                            </div>

                        </section>
                        <section class="mdl-layout__tab-panel" id="scroll-tab-2">
                            <div class="page-content">
                                <!-- Your content goes here -->

                                <div id="zone1" style="width: 75%; margin: 0 auto;text-align: center;display: none">
                                    <table  class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
                                        <thead>
                                        <tr>
                                            <th class="mdl-data-table__cell--non-numeric"></th>
                                            <th>所在院系</th>
                                            <th>课程名称</th>
                                            <th>学生姓名</th>
                                            <th>任课教师</th>
                                            <th>更新日期</th>
                                        </tr>
                                        </thead>
                                        <tbody id="upd_ap_table">
                                        </tbody>
                                    </table>
                                </div>
                                <!--更新的复查-->
                            </div>
                        </section>
                        <section class="mdl-layout__tab-panel" id="scroll-tab-3">
                            <div class="page-content">
                                <!--已标记的复查-->
                            </div>
                        </section>
                        <section class="mdl-layout__tab-panel" id="scroll-tab-4">
                            <div class="page-content">
                                <!-- Your content goes here -->
                                <div id="zone2" style="width: 75%; margin: 0 auto;text-align: center;display: none">
                                    <table  class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
                                        <thead>
                                        <tr>
                                            <th class="mdl-data-table__cell--non-numeric"></th>
                                            <th>所在院系</th>
                                            <th>课程名称</th>
                                            <th>学生姓名</th>
                                            <th>任课教师</th>
                                            <th>更新日期</th>
                                        </tr>
                                        </thead>
                                        <tbody id="respond_ap_table">
                                        </tbody>
                                    </table>
                                </div>

                                <!--已回执的复查-->
                            </div>
                        </section>
                        <section class="mdl-layout__tab-panel" id="scroll-tab-5">
                            <div class="page-content">
                                <!-- Your content goes here -->
                                <div id="zone3" style="width: 75%; margin: 0 auto;text-align: center;display: none">
                                    <table  class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
                                        <thead>
                                        <tr>
                                            <th class="mdl-data-table__cell--non-numeric"></th>
                                            <th>所在院系</th>
                                            <th>课程名称</th>
                                            <th>学生姓名</th>
                                            <th>任课教师</th>
                                            <th>更新日期</th>
                                        </tr>
                                        </thead>
                                        <tbody id="closed_ap_table">
                                        </tbody>
                                    </table>
                                </div>

                                <!--已关闭的复查-->
                            </div>
                        </section>
                        <section class="mdl-layout__tab-panel" id="scroll-tab-6">
                            <div class="page-content">
                                <!-- Your content goes here -->
                                <div id="zone4" style="width: 75%; margin: 0 auto;text-align: center;display: none">
                                    <table  class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
                                        <thead>
                                        <tr>
                                            <th class="mdl-data-table__cell--non-numeric"></th>
                                            <th>所在院系</th>
                                            <th>课程名称</th>
                                            <th>学生姓名</th>
                                            <th>任课教师</th>
                                            <th>更新日期</th>
                                        </tr>
                                        </thead>
                                        <tbody id="all_ap_table">
                                        </tbody>
                                    </table>
                                </div>

                                <!--全部复查-->
                            </div>
                        </section>
                        <section class="mdl-layout__tab-panel" id="scroll-tab-7">
                            <div class="page-content">
                                <!-- Your content goes here -->
                                <div id="zone5" style="width: 75%; margin: 0 auto;text-align: center;display: none">
                                    <table  class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
                                        <thead>
                                        <tr>
                                            <th class="mdl-data-table__cell--non-numeric"></th>
                                            <th>所在院系</th>
                                            <th>课程名称</th>
                                            <th>学生姓名</th>
                                            <th>任课教师</th>
                                            <th>更新日期</th>
                                        </tr>
                                        </thead>
                                        <tbody id="draw_ap_table">
                                        </tbody>
                                    </table>
                                </div>
                                <!--草稿箱-->
                            </div>
                        </section>
                    </main>
                </div>
                <!--content ends-->
            </div>
        </section>
        <section class="mdl-layout__tab-panel" id="fixed-tab-5">
            <div class="page-content">
                <!-- Your content goes here -->
                <div class="mdl-layout mdl-js-layout mdl-layout--fixed-header
            mdl-layout--fixed-tabs">
                    <header class="mdl-layout__header">
                        <!-- Tabs -->
                        <div class="mdl-layout__tab-bar mdl-js-ripple-effect">
                            <a href="#static-tab-1" class="mdl-layout__tab is-active">统计与评议</a>
                            <a href="#static-tab-2" class="mdl-layout__tab">历史评议</a>
                        </div>
                    </header>
                    <main class="mdl-layout__content">
                        <section class="mdl-layout__tab-panel is-active" id="static-tab-1">
                            <div class="page-content">
                                <!-- Your content goes here -->
                            </div>
                        </section>
                        <section class="mdl-layout__tab-panel" id="static-tab-2">
                            <div class="page-content">
                                <!-- Your content goes here --></div>
                        </section>
                    </main>
                </div>
                <!--content ends-->
            </div>
        </section>
    </main>
    <script src="script/newappeals.js"></script>
</div>

<dialog name="dialog" class="mdl-dialog--full-width">
    <h2 class="mdl-dialog__title" id="dia-title"></h2>
    <div class="mdl-dialog__content">
        <ul class="demo-list-item mdl-list">
            <li class="mdl-list__item">
                <span class="mdl-list__item-primary-content">
                   教师编号:<div id="tchId"></div>
                </span>
            </li>
            <li class="mdl-list__item">
                <span class="mdl-list__item-primary-content">
                   姓名:<div id="name"></div>
                </span>
            </li>
            <li class="mdl-list__item">
                <span class="mdl-list__item-primary-content">
                   电话:<div id="phone"></div>
                </span>
            </li>
            <li class="mdl-list__item">
                <span class="mdl-list__item-primary-content">
                   邮件:<div id="email"></div>
                </span>
            </li>
            <li class="mdl-list__item">
                <span class="mdl-list__item-primary-content">
                   性别:<div id="gender"></div>
                </span>
            </li>
            <li class="mdl-list__item">
                <span class="mdl-list__item-primary-content">
                   地址:<div id="address"></div>
                </span>
            </li>
            <li class="mdl-list__item">
                <span class="mdl-list__item-primary-content">
                   生日:<div id="birthday"></div>
                </span>
            </li>
            <li class="mdl-list__item">
                <span class="mdl-list__item-primary-content">
                   个人简介:<div id="biography"></div>
                </span>
            </li>

            <li class="mdl-list__item">
                <span class="mdl-list__item-primary-content">
                   所在院系:<div id="dpmName"></div>
                </span>
            </li>

        </ul>
    </div>

    <div class="mdl-dialog__actions">
        <button type="button" class="mdl-button ok">确定</button>
        <button type="button" class="mdl-button close">取消</button>
    </div>
</dialog>

<script type="text/javascript">

    $("#info").click(function () {
        $("#dia-title").text("个人信息");
        $.ajax({
            type:"post",
            url:"/ssmis/teacher/selfInfo",
            data:{
                tid:sessionStorage.tchid
            },
            success:function(data){
                console.log(data);
                var tchId = data.tchId;
                var name = data.name;
                var phone = data.phone;
                var email = data.email;
                var gender = data.gender == 0? "男":"女";
                var address = data.address;
                var birthday = data.birthday.split("T")[0];
                var dpmName = data.departmentByDpmId.dpmName;
                var biography = data.biography;
                $("#tchId").text(tchId);
                $("#name").text(name);
                $("#phone").text(phone);
                $("#email").text(email);
                $("#gender").text(gender);
                $("#address").text(address);
                $("#birthday").text(birthday);
                $("#dpmName").text(dpmName);
                $("#biography").text(biography);
            }
        });
        var dialog = document.querySelector('dialog')
        dialog.showModal();
        if (! dialog.showModal) {
            dialogPolyfill.registerDialog(dialog);
        }
        dialog.querySelector('.ok').addEventListener('click', function() {

            dialog.close();
        });
        dialog.querySelector('.close').addEventListener('click', function() {
            dialog.close();
        })

    });

    $("#mod").click(function () {

        $.ajax({
            type:"post",
            url:"/ssmis/teacher/selfInfo",
            data:{
                tid:sessionStorage.tchid
            },
            success:function(data){
                console.log(data);
                var tchId = data.tchId;
                var name = data.name;
                var phone = data.phone;
                var email = data.email;
                var gender = data.gender == 0? "男":"女";
                var address = data.address;
                var birthday = data.birthday.split("T")[0];
                var dpmName = data.departmentByDpmId.dpmName;
                var biography = data.biography;
                $("#tchId").text(tchId);
                $("#name").html("<input type='text' id='nameInput' value='"+name+"'/>");
                $("#phone").html("<input type='text' id='phoneInput' value='"+phone+"'/>");
                $("#email").html("<input type='text' id='emailInput' value='"+email+"'/>");
                $("#gender").html(gender);
                $("#address").html("<input type='text' id='addressInput' value='"+address+"'/>");
                $("#birthday").html("<input type='text' id='birthdayInput' value='"+birthday+"'/>");
                $("#dpmName").html(dpmName);
                $("#biography").html("<input type='text' id='biographyInput' value='"+biography+"'/>");
            }
        });
        var dialog = document.querySelector('dialog')
        dialog.showModal();
        if (! dialog.showModal) {
            dialogPolyfill.registerDialog(dialog);
        }
        dialog.querySelector('.ok').addEventListener('click', function() {
            var data = {
                'teacher.tchId':$("#tchId").text(),
                'teacher.name':$("#nameInput").val(),
                'teacher.email':$("#emailInput").val(),
                'teacher.address':$("#addressInput").val(),
                'teacher.phone':$("#phoneInput").val(),
                'teacher.birthday':$("#birthdayInput").val(),
                'teacher.biography':$("#biographyInput").val()
            };
            $.ajax({
                type:"post",
                url:"/ssmis/teacher/updateInfo",
                data:data,
                success:function(data){
                }
            })
            dialog.close();
        });
        dialog.querySelector('.close').addEventListener('click', function() {
            dialog.close();
        })
    })

    $("#logout").click(function () {
        sessionStorage.clear()
        delCookie("rmbUser");
        delCookie("username");
        delCookie("password");
        window.location.href="http://localhost:8080/ssmis/"

    })

    function delCookie(name)
    {
        var exp = new Date();
        exp.setTime(exp.getTime() - 1);
        var cval=getCookie(name);
        if(cval!=null)
            document.cookie= name + "="+cval+";expires="+exp.toGMTString();
    }

    function getCookie(name)
    {
        var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
        if(arr=document.cookie.match(reg))
            return unescape(arr[2]);
        else
            return null;
    }
</script>
</body>
</html>
<script src="./js/loadenterscore.js"></script>